<?php
if (session_id() == "") session_start(); // Initialize Session data
ob_start(); // Turn on output buffering
?>
<?php include_once "ewcfg8.php" ?>
<?php include_once "ewmysql8.php" ?>
<?php include_once "phpfn8.php" ?>
<?php

// Global variable for table object
$ReportTransaction = NULL;

//
// Table class for ReportTransaction
//
class cReportTransaction {
	var $TableVar = 'ReportTransaction';
	var $TableName = 'ReportTransaction';
	var $TableType = 'REPORT';
	var $name;
	var $notel;
	var $no_ahli;
	var $zemail;
	var $order_no;
	var $amount;
	var $status_payment;
	var $status_transaction;
	var $total_item;
	var $total_weight;
	var $postage_price;
	var $items_price;
	var $type_price;
	var $remarks;
	var $consignment_no;
	var $quantity;
	var $pricetype;
	var $price;
	var $totalprice;
	var $weight;
	var $totalweight;
	var $item_name;
	var $fields = array();
	var $UseTokenInUrl = EW_USE_TOKEN_IN_URL;
	var $Export; // Export
	var $ExportOriginalValue = EW_EXPORT_ORIGINAL_VALUE;
	var $ExportAll = TRUE;
	var $ExportPageBreakCount = 0; // Page break per every n record (PDF only)
	var $SendEmail; // Send email
	var $TableCustomInnerHtml; // Custom inner HTML
	var $BasicSearchKeyword; // Basic search keyword
	var $BasicSearchType; // Basic search type
	var $CurrentFilter; // Current filter
	var $CurrentOrder; // Current order
	var $CurrentOrderType; // Current order type
	var $RowType; // Row type
	var $CssClass; // CSS class
	var $CssStyle; // CSS style
	var $RowAttrs = array(); // Row custom attributes

	// Reset attributes for table object
	function ResetAttrs() {
		$this->CssClass = "";
		$this->CssStyle = "";
    	$this->RowAttrs = array();
		foreach ($this->fields as $fld) {
			$fld->ResetAttrs();
		}
	}

	// Setup field titles
	function SetupFieldTitles() {
		foreach ($this->fields as &$fld) {
			if (strval($fld->FldTitle()) <> "") {
				$fld->EditAttrs["onmouseover"] = "ew_ShowTitle(this, '" . ew_JsEncode3($fld->FldTitle()) . "');";
				$fld->EditAttrs["onmouseout"] = "ew_HideTooltip();";
			}
		}
	}
	var $TableFilter = "";

	//
	// Table class constructor
	//
	function cReportTransaction() {
		global $Language;

		// name
		$this->name = new cField('ReportTransaction', 'ReportTransaction', 'x_name', 'name', '`name`', 200, -1, FALSE, '`name`', FALSE, FALSE, 'FORMATTED TEXT');
		$this->fields['name'] =& $this->name;

		// notel
		$this->notel = new cField('ReportTransaction', 'ReportTransaction', 'x_notel', 'notel', '`notel`', 200, -1, FALSE, '`notel`', FALSE, FALSE, 'FORMATTED TEXT');
		$this->fields['notel'] =& $this->notel;

		// no_ahli
		$this->no_ahli = new cField('ReportTransaction', 'ReportTransaction', 'x_no_ahli', 'no_ahli', '`no_ahli`', 200, -1, FALSE, '`no_ahli`', FALSE, FALSE, 'FORMATTED TEXT');
		$this->fields['no_ahli'] =& $this->no_ahli;

		// email
		$this->zemail = new cField('ReportTransaction', 'ReportTransaction', 'x_zemail', 'email', '`email`', 200, -1, FALSE, '`email`', FALSE, FALSE, 'FORMATTED TEXT');
		$this->fields['email'] =& $this->zemail;

		// order_no
		$this->order_no = new cField('ReportTransaction', 'ReportTransaction', 'x_order_no', 'order_no', '`order_no`', 200, -1, FALSE, '`order_no`', FALSE, FALSE, 'FORMATTED TEXT');
		$this->fields['order_no'] =& $this->order_no;

		// amount
		$this->amount = new cField('ReportTransaction', 'ReportTransaction', 'x_amount', 'amount', '`amount`', 5, -1, FALSE, '`amount`', FALSE, FALSE, 'FORMATTED TEXT');
		$this->amount->FldDefaultErrMsg = $Language->Phrase("IncorrectFloat");
		$this->fields['amount'] =& $this->amount;

		// status_payment
		$this->status_payment = new cField('ReportTransaction', 'ReportTransaction', 'x_status_payment', 'status_payment', '`status_payment`', 200, -1, FALSE, '`status_payment`', FALSE, FALSE, 'FORMATTED TEXT');
		$this->fields['status_payment'] =& $this->status_payment;

		// status_transaction
		$this->status_transaction = new cField('ReportTransaction', 'ReportTransaction', 'x_status_transaction', 'status_transaction', '`status_transaction`', 200, -1, FALSE, '`status_transaction`', FALSE, FALSE, 'FORMATTED TEXT');
		$this->fields['status_transaction'] =& $this->status_transaction;

		// total_item
		$this->total_item = new cField('ReportTransaction', 'ReportTransaction', 'x_total_item', 'total_item', '`total_item`', 5, -1, FALSE, '`total_item`', FALSE, FALSE, 'FORMATTED TEXT');
		$this->total_item->FldDefaultErrMsg = $Language->Phrase("IncorrectFloat");
		$this->fields['total_item'] =& $this->total_item;

		// total_weight
		$this->total_weight = new cField('ReportTransaction', 'ReportTransaction', 'x_total_weight', 'total_weight', '`total_weight`', 5, -1, FALSE, '`total_weight`', FALSE, FALSE, 'FORMATTED TEXT');
		$this->total_weight->FldDefaultErrMsg = $Language->Phrase("IncorrectFloat");
		$this->fields['total_weight'] =& $this->total_weight;

		// postage_price
		$this->postage_price = new cField('ReportTransaction', 'ReportTransaction', 'x_postage_price', 'postage_price', '`postage_price`', 5, -1, FALSE, '`postage_price`', FALSE, FALSE, 'FORMATTED TEXT');
		$this->postage_price->FldDefaultErrMsg = $Language->Phrase("IncorrectFloat");
		$this->fields['postage_price'] =& $this->postage_price;

		// items_price
		$this->items_price = new cField('ReportTransaction', 'ReportTransaction', 'x_items_price', 'items_price', '`items_price`', 5, -1, FALSE, '`items_price`', FALSE, FALSE, 'FORMATTED TEXT');
		$this->items_price->FldDefaultErrMsg = $Language->Phrase("IncorrectFloat");
		$this->fields['items_price'] =& $this->items_price;

		// type_price
		$this->type_price = new cField('ReportTransaction', 'ReportTransaction', 'x_type_price', 'type_price', '`type_price`', 200, -1, FALSE, '`type_price`', FALSE, FALSE, 'FORMATTED TEXT');
		$this->fields['type_price'] =& $this->type_price;

		// remarks
		$this->remarks = new cField('ReportTransaction', 'ReportTransaction', 'x_remarks', 'remarks', '`remarks`', 200, -1, FALSE, '`remarks`', FALSE, FALSE, 'FORMATTED TEXT');
		$this->fields['remarks'] =& $this->remarks;

		// consignment_no
		$this->consignment_no = new cField('ReportTransaction', 'ReportTransaction', 'x_consignment_no', 'consignment_no', '`consignment_no`', 200, -1, FALSE, '`consignment_no`', FALSE, FALSE, 'FORMATTED TEXT');
		$this->fields['consignment_no'] =& $this->consignment_no;

		// quantity
		$this->quantity = new cField('ReportTransaction', 'ReportTransaction', 'x_quantity', 'quantity', '`quantity`', 3, -1, FALSE, '`quantity`', FALSE, FALSE, 'FORMATTED TEXT');
		$this->quantity->FldDefaultErrMsg = $Language->Phrase("IncorrectInteger");
		$this->fields['quantity'] =& $this->quantity;

		// pricetype
		$this->pricetype = new cField('ReportTransaction', 'ReportTransaction', 'x_pricetype', 'pricetype', '`pricetype`', 200, -1, FALSE, '`pricetype`', FALSE, FALSE, 'FORMATTED TEXT');
		$this->fields['pricetype'] =& $this->pricetype;

		// price
		$this->price = new cField('ReportTransaction', 'ReportTransaction', 'x_price', 'price', '`price`', 5, -1, FALSE, '`price`', FALSE, FALSE, 'FORMATTED TEXT');
		$this->price->FldDefaultErrMsg = $Language->Phrase("IncorrectFloat");
		$this->fields['price'] =& $this->price;

		// totalprice
		$this->totalprice = new cField('ReportTransaction', 'ReportTransaction', 'x_totalprice', 'totalprice', '`totalprice`', 5, -1, FALSE, '`totalprice`', FALSE, FALSE, 'FORMATTED TEXT');
		$this->totalprice->FldDefaultErrMsg = $Language->Phrase("IncorrectFloat");
		$this->fields['totalprice'] =& $this->totalprice;

		// weight
		$this->weight = new cField('ReportTransaction', 'ReportTransaction', 'x_weight', 'weight', '`weight`', 5, -1, FALSE, '`weight`', FALSE, FALSE, 'FORMATTED TEXT');
		$this->weight->FldDefaultErrMsg = $Language->Phrase("IncorrectFloat");
		$this->fields['weight'] =& $this->weight;

		// totalweight
		$this->totalweight = new cField('ReportTransaction', 'ReportTransaction', 'x_totalweight', 'totalweight', '`totalweight`', 5, -1, FALSE, '`totalweight`', FALSE, FALSE, 'FORMATTED TEXT');
		$this->totalweight->FldDefaultErrMsg = $Language->Phrase("IncorrectFloat");
		$this->fields['totalweight'] =& $this->totalweight;

		// item_name
		$this->item_name = new cField('ReportTransaction', 'ReportTransaction', 'x_item_name', 'item_name', '`item_name`', 200, -1, FALSE, '`item_name`', FALSE, FALSE, 'FORMATTED TEXT');
		$this->fields['item_name'] =& $this->item_name;
	}

	// Get field values
	function GetFieldValues($propertyname) {
		$values = array();
		foreach ($this->fields as $fldname => $fld)
			$values[$fldname] =& $fld->$propertyname;
		return $values;
	}

	// Table caption
	function TableCaption() {
		global $Language;
		return $Language->TablePhrase($this->TableVar, "TblCaption");
	}

	// Page caption
	function PageCaption($Page) {
		global $Language;
		$Caption = $Language->TablePhrase($this->TableVar, "TblPageCaption" . $Page);
		if ($Caption == "") $Caption = "Page " . $Page;
		return $Caption;
	}

	// Report group level SQL
	function SqlGroupSelect() { // Select
		return "SELECT DISTINCT `name`,`no_ahli`,`order_no`,`amount`,`status_payment`,`status_transaction` FROM `reporttransactioncompleted`";
	}

	function SqlGroupWhere() { // Where
		return "";
	}

	function SqlGroupGroupBy() { // Group By
		return "";
	}

	function SqlGroupHaving() { // Having
		return "";
	}

	function SqlGroupOrderBy() { // Order By
		return "`name` ASC,`no_ahli` ASC,`order_no` ASC,`amount` ASC,`status_payment` ASC,`status_transaction` ASC";
	}

	// Report detail level SQL
	function SqlDetailSelect() { // Select
		return "SELECT * FROM `reporttransactioncompleted`";
	}

	function SqlDetailWhere() { // Where
		return "";
	}

	function SqlDetailGroupBy() { // Group By
		return "";
	}

	function SqlDetailHaving() { // Having
		return "";
	}

	function SqlDetailOrderBy() { // Order By
		return "`total_item` ASC,`total_weight` ASC,`postage_price` ASC";
	}

	// Check if Anonymous User is allowed
	function AllowAnonymousUser() {
		switch (EW_PAGE_ID) {
			case "add":
			case "register":
			case "addopt":
				return FALSE;
			case "edit":
			case "update":
				return FALSE;
			case "delete":
				return FALSE;
			case "view":
				return FALSE;
			case "search":
				return FALSE;
			default:
				return FALSE;
		}
	}

	// Apply User ID filters
	function ApplyUserIDFilters($sFilter) {
		return $sFilter;
	}

	// Report group SQL
	function GroupSQL() {
		$sFilter = $this->CurrentFilter;
		$sFilter = $this->ApplyUserIDFilters($sFilter);
		$sSort = "";
		return ew_BuildSelectSql($this->SqlGroupSelect(), $this->SqlGroupWhere(),
			 $this->SqlGroupGroupBy(), $this->SqlGroupHaving(),
			 $this->SqlGroupOrderBy(), $sFilter, $sSort);
	}

	// Report detail SQL
	function DetailSQL() {
		$sFilter = $this->CurrentFilter;
		$sFilter = $this->ApplyUserIDFilters($sFilter);
		$sSort = "";
		return ew_BuildSelectSql($this->SqlDetailSelect(), $this->SqlDetailWhere(),
			$this->SqlDetailGroupBy(), $this->SqlDetailHaving(),
			$this->SqlDetailOrderBy(), $sFilter, $sSort);
	}

	// Return page URL
	function getReturnUrl() {
		$name = EW_PROJECT_NAME . "_" . $this->TableVar . "_" . EW_TABLE_RETURN_URL;

		// Get referer URL automatically
		if (ew_ServerVar("HTTP_REFERER") <> "" && ew_ReferPage() <> ew_CurrentPage() && ew_ReferPage() <> "login.php") // Referer not same page or login page
			$_SESSION[$name] = ew_ServerVar("HTTP_REFERER"); // Save to Session
		if (@$_SESSION[$name] <> "") {
			return $_SESSION[$name];
		} else {
			return "ReportTransactionreport.php";
		}
	}

	function setReturnUrl($v) {
		$_SESSION[EW_PROJECT_NAME . "_" . $this->TableVar . "_" . EW_TABLE_RETURN_URL] = $v;
	}

	// List URL
	function ListUrl() {
		return "ReportTransactionreport.php";
	}

	// View URL
	function ViewUrl() {
		return $this->KeyUrl("", $this->UrlParm());
	}

	// Add URL
	function AddUrl() {
		$AddUrl = "";

//		$sUrlParm = $this->UrlParm();
//		if ($sUrlParm <> "")
//			$AddUrl .= "?" . $sUrlParm;

		return $AddUrl;
	}

	// Edit URL
	function EditUrl($parm = "") {
		return $this->KeyUrl("", $this->UrlParm($parm));
	}

	// Inline edit URL
	function InlineEditUrl() {
		return $this->KeyUrl(ew_CurrentPage(), $this->UrlParm("a=edit"));
	}

	// Copy URL
	function CopyUrl($parm = "") {
		return $this->KeyUrl("", $this->UrlParm($parm));
	}

	// Inline copy URL
	function InlineCopyUrl() {
		return $this->KeyUrl(ew_CurrentPage(), $this->UrlParm("a=copy"));
	}

	// Delete URL
	function DeleteUrl() {
		return $this->KeyUrl("", $this->UrlParm());
	}

	// Add key value to URL
	function KeyUrl($url, $parm = "") {
		$sUrl = $url . "?";
		if ($parm <> "") $sUrl .= $parm . "&";
		return $sUrl;
	}

	// Sort URL
	function SortUrl(&$fld) {
		if ($this->CurrentAction <> "" || $this->Export <> "" ||
			in_array($fld->FldType, array(128, 204, 205))) { // Unsortable data type
				return "";
		} elseif ($fld->Sortable) {
			$sUrlParm = $this->UrlParm("order=" . urlencode($fld->FldName) . "&ordertype=" . $fld->ReverseSort());
			return ew_CurrentPage() . "?" . $sUrlParm;
		} else {
			return "";
		}
	}

	// Add URL parameter
	function UrlParm($parm = "") {
		$UrlParm = ($this->UseTokenInUrl) ? "t=ReportTransaction" : "";
		if ($parm <> "") {
			if ($UrlParm <> "")
				$UrlParm .= "&";
			$UrlParm .= $parm;
		}
		return $UrlParm;
	}

	// Get record keys from $_POST/$_GET/$_SESSION
	function GetRecordKeys() {
		$arKeys = array();
		$arKey = array();
		if (isset($_POST["key_m"])) {
			$arKeys = ew_StripSlashes($_POST["key_m"]);
			$cnt = count($arKeys);
		} elseif (isset($_GET["key_m"])) {
			$arKeys = ew_StripSlashes($_GET["key_m"]);
			$cnt = count($arKeys);
		} elseif (isset($_GET)) {

			//return $arKeys; // do not return yet, so the values will also be checked by the following code
		}

		// check keys
		$ar = array();
		foreach ($arKeys as $key) {
			$ar[] = $key;
		}
		return $ar;
	}

	// Get key filter
	function GetKeyFilter() {
		$arKeys = $this->GetRecordKeys();
		$sKeyFilter = "";
		foreach ($arKeys as $key) {
			if ($sKeyFilter <> "") $sKeyFilter .= " OR ";
			$sKeyFilter .= "(" . $this->KeyFilter() . ")";
		}
		return $sKeyFilter;
	}

	// Load rows based on filter
	function &LoadRs($sFilter) {
		global $conn;

		// Set up filter (SQL WHERE clause) and get return SQL
		$this->CurrentFilter = $sFilter;
		$sSql = $this->SQL();
		$rs = $conn->Execute($sSql);
		return $rs;
	}

	// Row styles
	function RowStyles() {
		$sAtt = "";
		$sStyle = trim($this->CssStyle);
		if (@$this->RowAttrs["style"] <> "")
			$sStyle .= " " . $this->RowAttrs["style"];
		$sClass = trim($this->CssClass);
		if (@$this->RowAttrs["class"] <> "")
			$sClass .= " " . $this->RowAttrs["class"];
		if (trim($sStyle) <> "")
			$sAtt .= " style=\"" . trim($sStyle) . "\"";
		if (trim($sClass) <> "")
			$sAtt .= " class=\"" . trim($sClass) . "\"";
		return $sAtt;
	}

	// Row attributes
	function RowAttributes() {
		$sAtt = $this->RowStyles();
		if ($this->Export == "") {
			foreach ($this->RowAttrs as $k => $v) {
				if ($k <> "class" && $k <> "style" && trim($v) <> "")
					$sAtt .= " " . $k . "=\"" . trim($v) . "\"";
			}
		}
		return $sAtt;
	}

	// Field object by name
	function fields($fldname) {
		return $this->fields[$fldname];
	}

	// Row Rendering event
	function Row_Rendering() {

		// Enter your code here	
	}

	// Row Rendered event
	function Row_Rendered() {

		// To view properties of field class, use:
		//var_dump($this-><FieldName>); 

	}
}
?>
<?php include_once "userfn8.php" ?>
<?php ew_Header(TRUE) ?>
<?php

// Create page object
$ReportTransaction_report = new cReportTransaction_report();
$Page =& $ReportTransaction_report;

// Page init
$ReportTransaction_report->Page_Init();

// Page main
$ReportTransaction_report->Page_Main();
?>
<?php include_once "header.php" ?>
<?php if ($ReportTransaction->Export == "") { ?>
<script language="JavaScript" type="text/javascript">
<!--

// Write your client script here, no need to add script tags.
//-->

</script>
<?php } ?>
<?php if ($ReportTransaction->Export == "") { ?>
<?php } ?>
<p class="phpmaker ewTitle"><?php echo $Language->Phrase("TblTypeReport") ?><?php echo $ReportTransaction->TableCaption() ?>
&nbsp;&nbsp;<?php $ReportTransaction_report->ExportOptions->Render("body"); ?>
</p>
<?php $ReportTransaction_report->ShowPageHeader(); ?>
<form method="post">
<table class="ewReportTable" cellspacing="-1">
<?php
$ReportTransaction_report->DefaultFilter = "";
$ReportTransaction_report->ReportFilter = $ReportTransaction_report->DefaultFilter;
if ($ReportTransaction_report->DbDetailFilter <> "") {
	if ($ReportTransaction_report->ReportFilter <> "") $ReportTransaction_report->ReportFilter .= " AND ";
	$ReportTransaction_report->ReportFilter .= "(" . $ReportTransaction_report->DbDetailFilter . ")";
}

// Set up filter and load Group level sql
$ReportTransaction->CurrentFilter = $ReportTransaction_report->ReportFilter;
$ReportTransaction_report->ReportSql = $ReportTransaction->GroupSQL();

// Load recordset
$ReportTransaction_report->Recordset = $conn->Execute($ReportTransaction_report->ReportSql);

// Get First Row
if (!$ReportTransaction_report->Recordset->EOF) {
	$ReportTransaction->name->setDbValue($ReportTransaction_report->Recordset->fields('name'));
	$ReportTransaction_report->ReportGroups[0] = $ReportTransaction->name->DbValue;
	$ReportTransaction->no_ahli->setDbValue($ReportTransaction_report->Recordset->fields('no_ahli'));
	$ReportTransaction_report->ReportGroups[1] = $ReportTransaction->no_ahli->DbValue;
	$ReportTransaction->order_no->setDbValue($ReportTransaction_report->Recordset->fields('order_no'));
	$ReportTransaction_report->ReportGroups[2] = $ReportTransaction->order_no->DbValue;
	$ReportTransaction->amount->setDbValue($ReportTransaction_report->Recordset->fields('amount'));
	$ReportTransaction_report->ReportGroups[3] = $ReportTransaction->amount->DbValue;
	$ReportTransaction->status_payment->setDbValue($ReportTransaction_report->Recordset->fields('status_payment'));
	$ReportTransaction_report->ReportGroups[4] = $ReportTransaction->status_payment->DbValue;
	$ReportTransaction->status_transaction->setDbValue($ReportTransaction_report->Recordset->fields('status_transaction'));
	$ReportTransaction_report->ReportGroups[5] = $ReportTransaction->status_transaction->DbValue;
}
$ReportTransaction_report->RecCnt = 0;
$ReportTransaction_report->ReportCounts[0] = 0;
$ReportTransaction_report->ChkLvlBreak();
while (!$ReportTransaction_report->Recordset->EOF) {

	// Render for view
	$ReportTransaction->RowType = EW_ROWTYPE_VIEW;
	$ReportTransaction->ResetAttrs();
	$ReportTransaction_report->RenderRow();

	// Show group headers
	if ($ReportTransaction_report->LevelBreak[1]) { // Reset counter and aggregation
?>
	<tr><td class="ewGroupField"><span class="phpmaker"><?php echo $ReportTransaction->name->FldCaption() ?></span></td>
	<td colspan=12 class="ewGroupName"><span class="phpmaker">
<div<?php echo $ReportTransaction->name->ViewAttributes() ?>><?php echo $ReportTransaction->name->ViewValue ?></div></span></td></tr>
<?php
	}
	if ($ReportTransaction_report->LevelBreak[2]) { // Reset counter and aggregation
?>
	<tr><td class="ewGroupField"><span class="phpmaker"><?php echo $ReportTransaction->no_ahli->FldCaption() ?></span></td>
	<td colspan=12 class="ewGroupName"><span class="phpmaker">
<div<?php echo $ReportTransaction->no_ahli->ViewAttributes() ?>><?php echo $ReportTransaction->no_ahli->ViewValue ?></div></span></td></tr>
<?php
	}
	if ($ReportTransaction_report->LevelBreak[3]) { // Reset counter and aggregation
?>
	<tr><td class="ewGroupField"><span class="phpmaker"><?php echo $ReportTransaction->order_no->FldCaption() ?></span></td>
	<td colspan=12 class="ewGroupName"><span class="phpmaker">
<div<?php echo $ReportTransaction->order_no->ViewAttributes() ?>><?php echo $ReportTransaction->order_no->ViewValue ?></div></span></td></tr>
<?php
	}
	if ($ReportTransaction_report->LevelBreak[4]) { // Reset counter and aggregation
?>
	<tr><td class="ewGroupField"><span class="phpmaker"><?php echo $ReportTransaction->amount->FldCaption() ?></span></td>
	<td colspan=12 class="ewGroupName"><span class="phpmaker">
<div<?php echo $ReportTransaction->amount->ViewAttributes() ?>><?php echo $ReportTransaction->amount->ViewValue ?></div></span></td></tr>
<?php
	}
	if ($ReportTransaction_report->LevelBreak[5]) { // Reset counter and aggregation
?>
	<tr><td class="ewGroupField"><span class="phpmaker"><?php echo $ReportTransaction->status_payment->FldCaption() ?></span></td>
	<td colspan=12 class="ewGroupName"><span class="phpmaker">
<div<?php echo $ReportTransaction->status_payment->ViewAttributes() ?>><?php echo $ReportTransaction->status_payment->ViewValue ?></div></span></td></tr>
<?php
	}
	if ($ReportTransaction_report->LevelBreak[6]) { // Reset counter and aggregation
?>
	<tr><td class="ewGroupField"><span class="phpmaker"><?php echo $ReportTransaction->status_transaction->FldCaption() ?></span></td>
	<td colspan=12 class="ewGroupName"><span class="phpmaker">
<div<?php echo $ReportTransaction->status_transaction->ViewAttributes() ?>><?php echo $ReportTransaction->status_transaction->ViewValue ?></div></span></td></tr>
<?php
	}

	// Get detail records
	$ReportTransaction_report->ReportFilter = $ReportTransaction_report->DefaultFilter;
	if ($ReportTransaction_report->ReportFilter <> "") $ReportTransaction_report->ReportFilter .= " AND ";
	if (is_null($ReportTransaction->name->CurrentValue)) {
		$ReportTransaction_report->ReportFilter .= "(`name` IS NULL)";
	} else {
		$ReportTransaction_report->ReportFilter .= "(`name` = '" . ew_AdjustSql($ReportTransaction->name->CurrentValue) . "')";
	}
	if ($ReportTransaction_report->ReportFilter <> "") $ReportTransaction_report->ReportFilter .= " AND ";
	if (is_null($ReportTransaction->no_ahli->CurrentValue)) {
		$ReportTransaction_report->ReportFilter .= "(`no_ahli` IS NULL)";
	} else {
		$ReportTransaction_report->ReportFilter .= "(`no_ahli` = '" . ew_AdjustSql($ReportTransaction->no_ahli->CurrentValue) . "')";
	}
	if ($ReportTransaction_report->ReportFilter <> "") $ReportTransaction_report->ReportFilter .= " AND ";
	if (is_null($ReportTransaction->order_no->CurrentValue)) {
		$ReportTransaction_report->ReportFilter .= "(`order_no` IS NULL)";
	} else {
		$ReportTransaction_report->ReportFilter .= "(`order_no` = '" . ew_AdjustSql($ReportTransaction->order_no->CurrentValue) . "')";
	}
	if ($ReportTransaction_report->ReportFilter <> "") $ReportTransaction_report->ReportFilter .= " AND ";
	if (is_null($ReportTransaction->amount->CurrentValue)) {
		$ReportTransaction_report->ReportFilter .= "(`amount` IS NULL)";
	} else {
		$ReportTransaction_report->ReportFilter .= "(`amount` = " . ew_AdjustSql($ReportTransaction->amount->CurrentValue) . ")";
	}
	if ($ReportTransaction_report->ReportFilter <> "") $ReportTransaction_report->ReportFilter .= " AND ";
	if (is_null($ReportTransaction->status_payment->CurrentValue)) {
		$ReportTransaction_report->ReportFilter .= "(`status_payment` IS NULL)";
	} else {
		$ReportTransaction_report->ReportFilter .= "(`status_payment` = '" . ew_AdjustSql($ReportTransaction->status_payment->CurrentValue) . "')";
	}
	if ($ReportTransaction_report->ReportFilter <> "") $ReportTransaction_report->ReportFilter .= " AND ";
	if (is_null($ReportTransaction->status_transaction->CurrentValue)) {
		$ReportTransaction_report->ReportFilter .= "(`status_transaction` IS NULL)";
	} else {
		$ReportTransaction_report->ReportFilter .= "(`status_transaction` = '" . ew_AdjustSql($ReportTransaction->status_transaction->CurrentValue) . "')";
	}
	if ($ReportTransaction_report->DbDetailFilter <> "") {
		if ($ReportTransaction_report->ReportFilter <> "")
			$ReportTransaction_report->ReportFilter .= " AND ";
		$ReportTransaction_report->ReportFilter .= "(" . $ReportTransaction_report->DbDetailFilter . ")";
	}

	// Set up detail SQL
	$ReportTransaction->CurrentFilter = $ReportTransaction_report->ReportFilter;
	$ReportTransaction_report->ReportSql = $ReportTransaction->DetailSQL();

	// Load detail records
	$ReportTransaction_report->DetailRecordset = $conn->Execute($ReportTransaction_report->ReportSql);
	$ReportTransaction_report->DtlRecordCount = $ReportTransaction_report->DetailRecordset->RecordCount();

	// Initialize aggregates
	if (!$ReportTransaction_report->DetailRecordset->EOF) {
		$ReportTransaction_report->RecCnt++;
	}
	if ($ReportTransaction_report->RecCnt == 1) {
		$ReportTransaction_report->ReportCounts[0] = 0;
	}
	for ($i = 1; $i <= 6; $i++) {
		if ($ReportTransaction_report->LevelBreak[$i]) { // Reset counter and aggregation
			$ReportTransaction_report->ReportCounts[$i] = 0;
		}
	}
	$ReportTransaction_report->ReportCounts[0] += $ReportTransaction_report->DtlRecordCount;
	$ReportTransaction_report->ReportCounts[1] += $ReportTransaction_report->DtlRecordCount;
	$ReportTransaction_report->ReportCounts[2] += $ReportTransaction_report->DtlRecordCount;
	$ReportTransaction_report->ReportCounts[3] += $ReportTransaction_report->DtlRecordCount;
	$ReportTransaction_report->ReportCounts[4] += $ReportTransaction_report->DtlRecordCount;
	$ReportTransaction_report->ReportCounts[5] += $ReportTransaction_report->DtlRecordCount;
	$ReportTransaction_report->ReportCounts[6] += $ReportTransaction_report->DtlRecordCount;
?>
	<tr>
		<td valign="top" class="ewGroupHeader"><span class="phpmaker"><?php echo $ReportTransaction->total_item->FldCaption() ?></span></td>
		<td valign="top" class="ewGroupHeader"><span class="phpmaker"><?php echo $ReportTransaction->total_weight->FldCaption() ?></span></td>
		<td valign="top" class="ewGroupHeader"><span class="phpmaker"><?php echo $ReportTransaction->postage_price->FldCaption() ?></span></td>
		<td valign="top" class="ewGroupHeader"><span class="phpmaker"><?php echo $ReportTransaction->items_price->FldCaption() ?></span></td>
		<td valign="top" class="ewGroupHeader"><span class="phpmaker"><?php echo $ReportTransaction->type_price->FldCaption() ?></span></td>
		<td valign="top" class="ewGroupHeader"><span class="phpmaker"><?php echo $ReportTransaction->remarks->FldCaption() ?></span></td>
		<td valign="top" class="ewGroupHeader"><span class="phpmaker"><?php echo $ReportTransaction->consignment_no->FldCaption() ?></span></td>
		<td valign="top" class="ewGroupHeader"><span class="phpmaker"><?php echo $ReportTransaction->quantity->FldCaption() ?></span></td>
		<td valign="top" class="ewGroupHeader"><span class="phpmaker"><?php echo $ReportTransaction->price->FldCaption() ?></span></td>
		<td valign="top" class="ewGroupHeader"><span class="phpmaker"><?php echo $ReportTransaction->totalprice->FldCaption() ?></span></td>
		<td valign="top" class="ewGroupHeader"><span class="phpmaker"><?php echo $ReportTransaction->weight->FldCaption() ?></span></td>
		<td valign="top" class="ewGroupHeader"><span class="phpmaker"><?php echo $ReportTransaction->totalweight->FldCaption() ?></span></td>
		<td valign="top" class="ewGroupHeader"><span class="phpmaker"><?php echo $ReportTransaction->item_name->FldCaption() ?></span></td>
	</tr>
<?php
	while (!$ReportTransaction_report->DetailRecordset->EOF) {
		$ReportTransaction->total_item->setDbValue($ReportTransaction_report->DetailRecordset->fields('total_item'));
		$ReportTransaction->total_weight->setDbValue($ReportTransaction_report->DetailRecordset->fields('total_weight'));
		$ReportTransaction->postage_price->setDbValue($ReportTransaction_report->DetailRecordset->fields('postage_price'));
		$ReportTransaction->items_price->setDbValue($ReportTransaction_report->DetailRecordset->fields('items_price'));
		$ReportTransaction->type_price->setDbValue($ReportTransaction_report->DetailRecordset->fields('type_price'));
		$ReportTransaction->remarks->setDbValue($ReportTransaction_report->DetailRecordset->fields('remarks'));
		$ReportTransaction->consignment_no->setDbValue($ReportTransaction_report->DetailRecordset->fields('consignment_no'));
		$ReportTransaction->quantity->setDbValue($ReportTransaction_report->DetailRecordset->fields('quantity'));
		$ReportTransaction->price->setDbValue($ReportTransaction_report->DetailRecordset->fields('price'));
		$ReportTransaction->totalprice->setDbValue($ReportTransaction_report->DetailRecordset->fields('totalprice'));
		$ReportTransaction->weight->setDbValue($ReportTransaction_report->DetailRecordset->fields('weight'));
		$ReportTransaction->totalweight->setDbValue($ReportTransaction_report->DetailRecordset->fields('totalweight'));
		$ReportTransaction->item_name->setDbValue($ReportTransaction_report->DetailRecordset->fields('item_name'));

		// Render for view
		$ReportTransaction->RowType = EW_ROWTYPE_VIEW;
		$ReportTransaction->ResetAttrs();
		$ReportTransaction_report->RenderRow();
?>
	<tr>
		<td><span class="phpmaker">
<div<?php echo $ReportTransaction->total_item->ViewAttributes() ?>><?php echo $ReportTransaction->total_item->ViewValue ?></div></span></td>
		<td><span class="phpmaker">
<div<?php echo $ReportTransaction->total_weight->ViewAttributes() ?>><?php echo $ReportTransaction->total_weight->ViewValue ?></div></span></td>
		<td><span class="phpmaker">
<div<?php echo $ReportTransaction->postage_price->ViewAttributes() ?>><?php echo $ReportTransaction->postage_price->ViewValue ?></div></span></td>
		<td><span class="phpmaker">
<div<?php echo $ReportTransaction->items_price->ViewAttributes() ?>><?php echo $ReportTransaction->items_price->ViewValue ?></div></span></td>
		<td><span class="phpmaker">
<div<?php echo $ReportTransaction->type_price->ViewAttributes() ?>><?php echo $ReportTransaction->type_price->ViewValue ?></div></span></td>
		<td><span class="phpmaker">
<div<?php echo $ReportTransaction->remarks->ViewAttributes() ?>><?php echo $ReportTransaction->remarks->ViewValue ?></div></span></td>
		<td><span class="phpmaker">
<div<?php echo $ReportTransaction->consignment_no->ViewAttributes() ?>><?php echo $ReportTransaction->consignment_no->ViewValue ?></div></span></td>
		<td><span class="phpmaker">
<div<?php echo $ReportTransaction->quantity->ViewAttributes() ?>><?php echo $ReportTransaction->quantity->ViewValue ?></div></span></td>
		<td><span class="phpmaker">
<div<?php echo $ReportTransaction->price->ViewAttributes() ?>><?php echo $ReportTransaction->price->ViewValue ?></div></span></td>
		<td><span class="phpmaker">
<div<?php echo $ReportTransaction->totalprice->ViewAttributes() ?>><?php echo $ReportTransaction->totalprice->ViewValue ?></div></span></td>
		<td><span class="phpmaker">
<div<?php echo $ReportTransaction->weight->ViewAttributes() ?>><?php echo $ReportTransaction->weight->ViewValue ?></div></span></td>
		<td><span class="phpmaker">
<div<?php echo $ReportTransaction->totalweight->ViewAttributes() ?>><?php echo $ReportTransaction->totalweight->ViewValue ?></div></span></td>
		<td><span class="phpmaker">
<div<?php echo $ReportTransaction->item_name->ViewAttributes() ?>><?php echo $ReportTransaction->item_name->ViewValue ?></div></span></td>
	</tr>
<?php
		$ReportTransaction_report->DetailRecordset->MoveNext();
	}
	$ReportTransaction_report->DetailRecordset->Close();

	// Save old group data
	$ReportTransaction_report->ReportGroups[0] = $ReportTransaction->name->CurrentValue;
	$ReportTransaction_report->ReportGroups[1] = $ReportTransaction->no_ahli->CurrentValue;
	$ReportTransaction_report->ReportGroups[2] = $ReportTransaction->order_no->CurrentValue;
	$ReportTransaction_report->ReportGroups[3] = $ReportTransaction->amount->CurrentValue;
	$ReportTransaction_report->ReportGroups[4] = $ReportTransaction->status_payment->CurrentValue;
	$ReportTransaction_report->ReportGroups[5] = $ReportTransaction->status_transaction->CurrentValue;

	// Get next record
	$ReportTransaction_report->Recordset->MoveNext();
	if ($ReportTransaction_report->Recordset->EOF) {
		$ReportTransaction_report->RecCnt = 0; // EOF, force all level breaks
	} else {
		$ReportTransaction->name->setDbValue($ReportTransaction_report->Recordset->fields('name'));
		$ReportTransaction->no_ahli->setDbValue($ReportTransaction_report->Recordset->fields('no_ahli'));
		$ReportTransaction->order_no->setDbValue($ReportTransaction_report->Recordset->fields('order_no'));
		$ReportTransaction->amount->setDbValue($ReportTransaction_report->Recordset->fields('amount'));
		$ReportTransaction->status_payment->setDbValue($ReportTransaction_report->Recordset->fields('status_payment'));
		$ReportTransaction->status_transaction->setDbValue($ReportTransaction_report->Recordset->fields('status_transaction'));
	}
	$ReportTransaction_report->ChkLvlBreak();

	// Show footers
	if ($ReportTransaction_report->LevelBreak[6]) {
		$ReportTransaction->status_transaction->CurrentValue = $ReportTransaction_report->ReportGroups[5];

		// Render row for view
		$ReportTransaction->RowType = EW_ROWTYPE_VIEW;
		$ReportTransaction->ResetAttrs();
		$ReportTransaction_report->RenderRow();
		$ReportTransaction->status_transaction->CurrentValue = $ReportTransaction->status_transaction->DbValue;
?>
<?php
}
	if ($ReportTransaction_report->LevelBreak[5]) {
		$ReportTransaction->status_payment->CurrentValue = $ReportTransaction_report->ReportGroups[4];

		// Render row for view
		$ReportTransaction->RowType = EW_ROWTYPE_VIEW;
		$ReportTransaction->ResetAttrs();
		$ReportTransaction_report->RenderRow();
		$ReportTransaction->status_payment->CurrentValue = $ReportTransaction->status_payment->DbValue;
?>
<?php
}
	if ($ReportTransaction_report->LevelBreak[4]) {
		$ReportTransaction->amount->CurrentValue = $ReportTransaction_report->ReportGroups[3];

		// Render row for view
		$ReportTransaction->RowType = EW_ROWTYPE_VIEW;
		$ReportTransaction->ResetAttrs();
		$ReportTransaction_report->RenderRow();
		$ReportTransaction->amount->CurrentValue = $ReportTransaction->amount->DbValue;
?>
<?php
}
	if ($ReportTransaction_report->LevelBreak[3]) {
		$ReportTransaction->order_no->CurrentValue = $ReportTransaction_report->ReportGroups[2];

		// Render row for view
		$ReportTransaction->RowType = EW_ROWTYPE_VIEW;
		$ReportTransaction->ResetAttrs();
		$ReportTransaction_report->RenderRow();
		$ReportTransaction->order_no->CurrentValue = $ReportTransaction->order_no->DbValue;
?>
<?php
}
	if ($ReportTransaction_report->LevelBreak[2]) {
		$ReportTransaction->no_ahli->CurrentValue = $ReportTransaction_report->ReportGroups[1];

		// Render row for view
		$ReportTransaction->RowType = EW_ROWTYPE_VIEW;
		$ReportTransaction->ResetAttrs();
		$ReportTransaction_report->RenderRow();
		$ReportTransaction->no_ahli->CurrentValue = $ReportTransaction->no_ahli->DbValue;
?>
<?php
}
	if ($ReportTransaction_report->LevelBreak[1]) {
		$ReportTransaction->name->CurrentValue = $ReportTransaction_report->ReportGroups[0];

		// Render row for view
		$ReportTransaction->RowType = EW_ROWTYPE_VIEW;
		$ReportTransaction->ResetAttrs();
		$ReportTransaction_report->RenderRow();
		$ReportTransaction->name->CurrentValue = $ReportTransaction->name->DbValue;
?>
	<tr><td colspan=13 class="ewGroupSummary"><span class="phpmaker"><?php echo $Language->Phrase("RptSumHead") ?>&nbsp;<?php echo $ReportTransaction->name->FldCaption() ?>:&nbsp;<?php echo $ReportTransaction->name->ViewValue ?> (<?php echo ew_FormatNumber($ReportTransaction_report->ReportCounts[1],0) ?> <?php echo $Language->Phrase("RptDtlRec") ?>)</span></td></tr>
	<tr><td colspan=19><span class="phpmaker">&nbsp;<br></span></td></tr>
<?php
}
}

// Close recordset
$ReportTransaction_report->Recordset->Close();
?>
	<tr><td colspan=13><span class="phpmaker">&nbsp;<br></span></td></tr>
	<tr><td colspan=13 class="ewGrandSummary"><span class="phpmaker"><?php echo $Language->Phrase("RptGrandTotal") ?>&nbsp;(<?php echo ew_FormatNumber($ReportTransaction_report->ReportCounts[0], 0) ?>&nbsp;<?php echo $Language->Phrase("RptDtlRec") ?>)</span></td></tr>
	<tr><td colspan=13><span class="phpmaker">&nbsp;<br></span></td></tr>
</table>
</form>
<?php
$ReportTransaction_report->ShowPageFooter();
if (EW_DEBUG_ENABLED)
	echo ew_DebugMsg();
?>
<?php if ($ReportTransaction->Export == "") { ?>
<script language="JavaScript" type="text/javascript">
<!--

// Write your table-specific startup script here
// document.write("page loaded");
//-->

</script>
<?php } ?>
<?php include_once "footer.php" ?>
<?php
$ReportTransaction_report->Page_Terminate();
?>
<?php

//
// Page class
//
class cReportTransaction_report {

	// Page ID
	var $PageID = 'report';

	// Table name
	var $TableName = 'ReportTransaction';

	// Page object name
	var $PageObjName = 'ReportTransaction_report';

	// Page name
	function PageName() {
		return ew_CurrentPage();
	}

	// Page URL
	function PageUrl() {
		$PageUrl = ew_CurrentPage() . "?";
		return $PageUrl;
	}

	// Page URLs
	var $AddUrl;
	var $EditUrl;
	var $CopyUrl;
	var $DeleteUrl;
	var $ViewUrl;
	var $ListUrl;

	// Export URLs
	var $ExportPrintUrl;
	var $ExportHtmlUrl;
	var $ExportExcelUrl;
	var $ExportWordUrl;
	var $ExportXmlUrl;
	var $ExportCsvUrl;
	var $ExportPdfUrl;

	// Update URLs
	var $InlineAddUrl;
	var $InlineCopyUrl;
	var $InlineEditUrl;
	var $GridAddUrl;
	var $GridEditUrl;
	var $MultiDeleteUrl;
	var $MultiUpdateUrl;

	// Message
	function getMessage() {
		return @$_SESSION[EW_SESSION_MESSAGE];
	}

	function setMessage($v) {
		ew_AddMessage($_SESSION[EW_SESSION_MESSAGE], $v);
	}

	function getFailureMessage() {
		return @$_SESSION[EW_SESSION_FAILURE_MESSAGE];
	}

	function setFailureMessage($v) {
		ew_AddMessage($_SESSION[EW_SESSION_FAILURE_MESSAGE], $v);
	}

	function getSuccessMessage() {
		return @$_SESSION[EW_SESSION_SUCCESS_MESSAGE];
	}

	function setSuccessMessage($v) {
		ew_AddMessage($_SESSION[EW_SESSION_SUCCESS_MESSAGE], $v);
	}

	// Show message
	function ShowMessage() {
		$sMessage = $this->getMessage();
		$this->Message_Showing($sMessage, "");
		if ($sMessage <> "") { // Message in Session, display
			echo "<p class=\"ewMessage\">" . $sMessage . "</p>";
			$_SESSION[EW_SESSION_MESSAGE] = ""; // Clear message in Session
		}

		// Success message
		$sSuccessMessage = $this->getSuccessMessage();
		$this->Message_Showing($sSuccessMessage, "success");
		if ($sSuccessMessage <> "") { // Message in Session, display
			echo "<p class=\"ewSuccessMessage\">" . $sSuccessMessage . "</p>";
			$_SESSION[EW_SESSION_SUCCESS_MESSAGE] = ""; // Clear message in Session
		}

		// Failure message
		$sErrorMessage = $this->getFailureMessage();
		$this->Message_Showing($sErrorMessage, "failure");
		if ($sErrorMessage <> "") { // Message in Session, display
			echo "<p class=\"ewErrorMessage\">" . $sErrorMessage . "</p>";
			$_SESSION[EW_SESSION_FAILURE_MESSAGE] = ""; // Clear message in Session
		}
	}
	var $PageHeader;
	var $PageFooter;

	// Show Page Header
	function ShowPageHeader() {
		$sHeader = $this->PageHeader;
		$this->Page_DataRendering($sHeader);
		if ($sHeader <> "") { // Header exists, display
			echo "<p class=\"phpmaker\">" . $sHeader . "</p>";
		}
	}

	// Show Page Footer
	function ShowPageFooter() {
		$sFooter = $this->PageFooter;
		$this->Page_DataRendered($sFooter);
		if ($sFooter <> "") { // Fotoer exists, display
			echo "<p class=\"phpmaker\">" . $sFooter . "</p>";
		}
	}

	// Validate page request
	function IsPageRequest() {
		return TRUE;
	}

	//
	// Page class constructor
	//
	function cReportTransaction_report() {
		global $conn, $Language;

		// Language object
		if (!isset($Language)) $Language = new cLanguage();

		// Table object (ReportTransaction)
		if (!isset($GLOBALS["ReportTransaction"])) {
			$GLOBALS["ReportTransaction"] = new cReportTransaction();
			$GLOBALS["Table"] =& $GLOBALS["ReportTransaction"];
		}

		// Initialize URLs
		$this->ExportPrintUrl = $this->PageUrl() . "export=print";
		$this->ExportExcelUrl = $this->PageUrl() . "export=excel";
		$this->ExportWordUrl = $this->PageUrl() . "export=word";

		// Page ID
		if (!defined("EW_PAGE_ID"))
			define("EW_PAGE_ID", 'report', TRUE);

		// Table name (for backward compatibility)
		if (!defined("EW_TABLE_NAME"))
			define("EW_TABLE_NAME", 'ReportTransaction', TRUE);

		// Start timer
		if (!isset($GLOBALS["gTimer"])) $GLOBALS["gTimer"] = new cTimer();

		// Open connection
		if (!isset($conn)) $conn = ew_Connect();

		// Export options
		$this->ExportOptions = new cListOptions();
		$this->ExportOptions->Tag = "span";
		$this->ExportOptions->Separator = "&nbsp;&nbsp;";
	}

	// 
	//  Page_Init
	//
	function Page_Init() {
		global $gsExport, $gsExportFile, $UserProfile, $Language, $Security, $objForm;
		global $ReportTransaction;

		// Security
		$Security = new cAdvancedSecurity();
		if (!$Security->IsLoggedIn()) $Security->AutoLogin();
		if (!$Security->IsLoggedIn()) {
			$Security->SaveLastUrl();
			$this->Page_Terminate("login.php");
		}

		// Get export parameters
		if (@$_GET["export"] <> "") {
			$ReportTransaction->Export = $_GET["export"];
		}
		$gsExport = $ReportTransaction->Export; // Get export parameter, used in header
		$gsExportFile = $ReportTransaction->TableVar; // Get export file, used in header
		$Charset = (EW_CHARSET <> "") ? ";charset=" . EW_CHARSET : ""; // Charset used in header
		if ($ReportTransaction->Export == "excel") {
			header('Content-Type: application/vnd.ms-excel' . $Charset);
			header('Content-Disposition: attachment; filename=' . $gsExportFile .'.xls');
		}
		if ($ReportTransaction->Export == "word") {
			header('Content-Type: application/vnd.ms-word' . $Charset);
			header('Content-Disposition: attachment; filename=' . $gsExportFile .'.doc');
		}

		// Setup export options
		$this->SetupExportOptions();

		// Global Page Loading event (in userfn*.php)
		Page_Loading();

		// Page Load event
		$this->Page_Load();
	}

	//
	// Page_Terminate
	//
	function Page_Terminate($url = "") {
		global $conn;

		// Page Unload event
		$this->Page_Unload();

		// Global Page Unloaded event (in userfn*.php)
		Page_Unloaded();
		$this->Page_Redirecting($url);

		 // Close connection
		$conn->Close();

		// Go to URL if specified
		if ($url <> "") {
			if (!EW_DEBUG_ENABLED && ob_get_length())
				ob_end_clean();
			header("Location: " . $url);
		}
		exit();
	}
	var $ExportOptions; // Export options
	var $RecCnt = 0;
	var $ReportSql = "";
	var $ReportFilter = "";
	var $DefaultFilter = "";
	var $DbMasterFilter = "";
	var $DbDetailFilter = "";
	var $MasterRecordExists;
	var $DtlRecordCount;
	var $ReportGroups;
	var $ReportCounts;
	var $LevelBreak;
	var $ReportTotals;
	var $ReportMaxs;
	var $ReportMins;
	var $Recordset;
	var $DetailRecordset;

	//
	// Page main
	//
	function Page_Main() {
		global $Language, $ReportTransaction;
		$this->ReportGroups =& ew_InitArray(7, NULL);
		$this->ReportCounts =& ew_InitArray(7, 0);
		$this->LevelBreak =& ew_InitArray(7, FALSE);
		$this->ReportTotals =& ew_Init2DArray(7, 14, 0);
		$this->ReportMaxs =& ew_Init2DArray(7, 14, 0);
		$this->ReportMins =& ew_Init2DArray(7, 14, 0);
	}

	// Check level break
	function ChkLvlBreak() {
		global $ReportTransaction;
		$this->LevelBreak[1] = FALSE;
		$this->LevelBreak[2] = FALSE;
		$this->LevelBreak[3] = FALSE;
		$this->LevelBreak[4] = FALSE;
		$this->LevelBreak[5] = FALSE;
		$this->LevelBreak[6] = FALSE;
		if ($this->RecCnt == 0) { // Start Or End of Recordset
			$this->LevelBreak[1] = TRUE;
			$this->LevelBreak[2] = TRUE;
			$this->LevelBreak[3] = TRUE;
			$this->LevelBreak[4] = TRUE;
			$this->LevelBreak[5] = TRUE;
			$this->LevelBreak[6] = TRUE;
		} else {
			if (!ew_CompareValue($ReportTransaction->name->CurrentValue, $this->ReportGroups[0])) {
				$this->LevelBreak[1] = TRUE;
				$this->LevelBreak[2] = TRUE;
				$this->LevelBreak[3] = TRUE;
				$this->LevelBreak[4] = TRUE;
				$this->LevelBreak[5] = TRUE;
				$this->LevelBreak[6] = TRUE;
			}
			if (!ew_CompareValue($ReportTransaction->no_ahli->CurrentValue, $this->ReportGroups[1])) {
				$this->LevelBreak[2] = TRUE;
				$this->LevelBreak[3] = TRUE;
				$this->LevelBreak[4] = TRUE;
				$this->LevelBreak[5] = TRUE;
				$this->LevelBreak[6] = TRUE;
			}
			if (!ew_CompareValue($ReportTransaction->order_no->CurrentValue, $this->ReportGroups[2])) {
				$this->LevelBreak[3] = TRUE;
				$this->LevelBreak[4] = TRUE;
				$this->LevelBreak[5] = TRUE;
				$this->LevelBreak[6] = TRUE;
			}
			if (!ew_CompareValue($ReportTransaction->amount->CurrentValue, $this->ReportGroups[3])) {
				$this->LevelBreak[4] = TRUE;
				$this->LevelBreak[5] = TRUE;
				$this->LevelBreak[6] = TRUE;
			}
			if (!ew_CompareValue($ReportTransaction->status_payment->CurrentValue, $this->ReportGroups[4])) {
				$this->LevelBreak[5] = TRUE;
				$this->LevelBreak[6] = TRUE;
			}
			if (!ew_CompareValue($ReportTransaction->status_transaction->CurrentValue, $this->ReportGroups[5])) {
				$this->LevelBreak[6] = TRUE;
			}
		}
	}

	// Render row values based on field settings
	function RenderRow() {
		global $conn, $Security, $Language, $ReportTransaction;

		// Initialize URLs
		// Call Row_Rendering event

		$ReportTransaction->Row_Rendering();

		// Common render codes for all row types
		// name
		// notel
		// no_ahli
		// email
		// order_no
		// amount
		// status_payment
		// status_transaction
		// total_item
		// total_weight
		// postage_price
		// items_price
		// type_price
		// remarks
		// consignment_no
		// quantity
		// pricetype
		// price
		// totalprice
		// weight
		// totalweight
		// item_name

		if ($ReportTransaction->RowType == EW_ROWTYPE_VIEW) { // View row

			// name
			$ReportTransaction->name->ViewValue = $ReportTransaction->name->CurrentValue;
			$ReportTransaction->name->CssStyle = "font-weight:bold;";
			$ReportTransaction->name->ViewCustomAttributes = "";

			// notel
			$ReportTransaction->notel->ViewValue = $ReportTransaction->notel->CurrentValue;
			$ReportTransaction->notel->CssStyle = "font-weight:bold;";
			$ReportTransaction->notel->ViewCustomAttributes = "";

			// no_ahli
			$ReportTransaction->no_ahli->ViewValue = $ReportTransaction->no_ahli->CurrentValue;
			$ReportTransaction->no_ahli->CssStyle = "font-weight:bold;";
			$ReportTransaction->no_ahli->ViewCustomAttributes = "";

			// email
			$ReportTransaction->zemail->ViewValue = $ReportTransaction->zemail->CurrentValue;
			$ReportTransaction->zemail->CssStyle = "font-weight:bold;";
			$ReportTransaction->zemail->ViewCustomAttributes = "";

			// order_no
			$ReportTransaction->order_no->ViewValue = $ReportTransaction->order_no->CurrentValue;
			$ReportTransaction->order_no->CssStyle = "font-weight:bold;";
			$ReportTransaction->order_no->ViewCustomAttributes = "";

			// amount
			$ReportTransaction->amount->ViewValue = $ReportTransaction->amount->CurrentValue;
			$ReportTransaction->amount->ViewValue = ew_FormatCurrency($ReportTransaction->amount->ViewValue, 2, -2, -2, -2);
			$ReportTransaction->amount->CssStyle = "font-weight:bold;";
			$ReportTransaction->amount->ViewCustomAttributes = "";

			// status_payment
			$ReportTransaction->status_payment->ViewValue = $ReportTransaction->status_payment->CurrentValue;
			$ReportTransaction->status_payment->CssStyle = "font-weight:bold;";
			$ReportTransaction->status_payment->ViewCustomAttributes = "";

			// status_transaction
			if (strval($ReportTransaction->status_transaction->CurrentValue) <> "") {
				switch ($ReportTransaction->status_transaction->CurrentValue) {
					case "Waiting from admin action":
						$ReportTransaction->status_transaction->ViewValue = $ReportTransaction->status_transaction->FldTagCaption(1) <> "" ? $ReportTransaction->status_transaction->FldTagCaption(1) : $ReportTransaction->status_transaction->CurrentValue;
						break;
					case "Admin has confirmed products have delivered to a courier":
						$ReportTransaction->status_transaction->ViewValue = $ReportTransaction->status_transaction->FldTagCaption(2) <> "" ? $ReportTransaction->status_transaction->FldTagCaption(2) : $ReportTransaction->status_transaction->CurrentValue;
						break;
					case "Admin has confirmed products have received by customer":
						$ReportTransaction->status_transaction->ViewValue = $ReportTransaction->status_transaction->FldTagCaption(3) <> "" ? $ReportTransaction->status_transaction->FldTagCaption(3) : $ReportTransaction->status_transaction->CurrentValue;
						break;
					case "Admin has confirmed products have received by customer":
						$ReportTransaction->status_transaction->ViewValue = $ReportTransaction->status_transaction->FldTagCaption(4) <> "" ? $ReportTransaction->status_transaction->FldTagCaption(4) : $ReportTransaction->status_transaction->CurrentValue;
						break;
					default:
						$ReportTransaction->status_transaction->ViewValue = $ReportTransaction->status_transaction->CurrentValue;
				}
			} else {
				$ReportTransaction->status_transaction->ViewValue = NULL;
			}
			$ReportTransaction->status_transaction->CssStyle = "font-weight:bold;";
			$ReportTransaction->status_transaction->ViewCustomAttributes = "";

			// total_item
			$ReportTransaction->total_item->ViewValue = $ReportTransaction->total_item->CurrentValue;
			$ReportTransaction->total_item->CssStyle = "font-weight:bold;";
			$ReportTransaction->total_item->ViewCustomAttributes = "";

			// total_weight
			$ReportTransaction->total_weight->ViewValue = $ReportTransaction->total_weight->CurrentValue;
			$ReportTransaction->total_weight->CssStyle = "font-weight:bold;";
			$ReportTransaction->total_weight->ViewCustomAttributes = "";

			// postage_price
			$ReportTransaction->postage_price->ViewValue = $ReportTransaction->postage_price->CurrentValue;
			$ReportTransaction->postage_price->CssStyle = "font-weight:bold;";
			$ReportTransaction->postage_price->ViewCustomAttributes = "";

			// items_price
			$ReportTransaction->items_price->ViewValue = $ReportTransaction->items_price->CurrentValue;
			$ReportTransaction->items_price->ViewValue = ew_FormatCurrency($ReportTransaction->items_price->ViewValue, 2, -2, -2, -2);
			$ReportTransaction->items_price->CssStyle = "font-weight:bold;";
			$ReportTransaction->items_price->ViewCustomAttributes = "";

			// type_price
			if (strval($ReportTransaction->type_price->CurrentValue) <> "") {
				switch ($ReportTransaction->type_price->CurrentValue) {
					case "Harga Biasa":
						$ReportTransaction->type_price->ViewValue = $ReportTransaction->type_price->FldTagCaption(1) <> "" ? $ReportTransaction->type_price->FldTagCaption(1) : $ReportTransaction->type_price->CurrentValue;
						break;
					case "Harga Untuk Keahlian Ana Edar":
						$ReportTransaction->type_price->ViewValue = $ReportTransaction->type_price->FldTagCaption(2) <> "" ? $ReportTransaction->type_price->FldTagCaption(2) : $ReportTransaction->type_price->CurrentValue;
						break;
					default:
						$ReportTransaction->type_price->ViewValue = $ReportTransaction->type_price->CurrentValue;
				}
			} else {
				$ReportTransaction->type_price->ViewValue = NULL;
			}
			$ReportTransaction->type_price->CssStyle = "font-weight:bold;";
			$ReportTransaction->type_price->ViewCustomAttributes = "";

			// remarks
			$ReportTransaction->remarks->ViewValue = $ReportTransaction->remarks->CurrentValue;
			$ReportTransaction->remarks->CssStyle = "font-weight:bold;";
			$ReportTransaction->remarks->ViewCustomAttributes = "";

			// consignment_no
			$ReportTransaction->consignment_no->ViewValue = $ReportTransaction->consignment_no->CurrentValue;
			$ReportTransaction->consignment_no->CssStyle = "font-weight:bold;";
			$ReportTransaction->consignment_no->ViewCustomAttributes = "";

			// quantity
			$ReportTransaction->quantity->ViewValue = $ReportTransaction->quantity->CurrentValue;
			$ReportTransaction->quantity->CssStyle = "font-weight:bold;";
			$ReportTransaction->quantity->ViewCustomAttributes = "";

			// pricetype
			$ReportTransaction->pricetype->ViewValue = $ReportTransaction->pricetype->CurrentValue;
			$ReportTransaction->pricetype->CssStyle = "font-weight:bold;";
			$ReportTransaction->pricetype->ViewCustomAttributes = "";

			// price
			$ReportTransaction->price->ViewValue = $ReportTransaction->price->CurrentValue;
			$ReportTransaction->price->ViewValue = ew_FormatCurrency($ReportTransaction->price->ViewValue, 2, -2, -2, -2);
			$ReportTransaction->price->CssStyle = "font-weight:bold;";
			$ReportTransaction->price->ViewCustomAttributes = "";

			// totalprice
			$ReportTransaction->totalprice->ViewValue = $ReportTransaction->totalprice->CurrentValue;
			$ReportTransaction->totalprice->ViewValue = ew_FormatCurrency($ReportTransaction->totalprice->ViewValue, 2, -2, -2, -2);
			$ReportTransaction->totalprice->CssStyle = "font-weight:bold;";
			$ReportTransaction->totalprice->ViewCustomAttributes = "";

			// weight
			$ReportTransaction->weight->ViewValue = $ReportTransaction->weight->CurrentValue;
			$ReportTransaction->weight->CssStyle = "font-weight:bold;";
			$ReportTransaction->weight->ViewCustomAttributes = "";

			// totalweight
			$ReportTransaction->totalweight->ViewValue = $ReportTransaction->totalweight->CurrentValue;
			$ReportTransaction->totalweight->CssStyle = "font-weight:bold;";
			$ReportTransaction->totalweight->ViewCustomAttributes = "";

			// item_name
			$ReportTransaction->item_name->ViewValue = $ReportTransaction->item_name->CurrentValue;
			$ReportTransaction->item_name->CssStyle = "font-weight:bold;";
			$ReportTransaction->item_name->ViewCustomAttributes = "";

			// name
			$ReportTransaction->name->LinkCustomAttributes = "";
			$ReportTransaction->name->HrefValue = "";
			$ReportTransaction->name->TooltipValue = "";

			// no_ahli
			$ReportTransaction->no_ahli->LinkCustomAttributes = "";
			$ReportTransaction->no_ahli->HrefValue = "";
			$ReportTransaction->no_ahli->TooltipValue = "";

			// order_no
			$ReportTransaction->order_no->LinkCustomAttributes = "";
			$ReportTransaction->order_no->HrefValue = "";
			$ReportTransaction->order_no->TooltipValue = "";

			// amount
			$ReportTransaction->amount->LinkCustomAttributes = "";
			$ReportTransaction->amount->HrefValue = "";
			$ReportTransaction->amount->TooltipValue = "";

			// status_payment
			$ReportTransaction->status_payment->LinkCustomAttributes = "";
			$ReportTransaction->status_payment->HrefValue = "";
			$ReportTransaction->status_payment->TooltipValue = "";

			// status_transaction
			$ReportTransaction->status_transaction->LinkCustomAttributes = "";
			$ReportTransaction->status_transaction->HrefValue = "";
			$ReportTransaction->status_transaction->TooltipValue = "";

			// total_item
			$ReportTransaction->total_item->LinkCustomAttributes = "";
			$ReportTransaction->total_item->HrefValue = "";
			$ReportTransaction->total_item->TooltipValue = "";

			// total_weight
			$ReportTransaction->total_weight->LinkCustomAttributes = "";
			$ReportTransaction->total_weight->HrefValue = "";
			$ReportTransaction->total_weight->TooltipValue = "";

			// postage_price
			$ReportTransaction->postage_price->LinkCustomAttributes = "";
			$ReportTransaction->postage_price->HrefValue = "";
			$ReportTransaction->postage_price->TooltipValue = "";

			// items_price
			$ReportTransaction->items_price->LinkCustomAttributes = "";
			$ReportTransaction->items_price->HrefValue = "";
			$ReportTransaction->items_price->TooltipValue = "";

			// type_price
			$ReportTransaction->type_price->LinkCustomAttributes = "";
			$ReportTransaction->type_price->HrefValue = "";
			$ReportTransaction->type_price->TooltipValue = "";

			// remarks
			$ReportTransaction->remarks->LinkCustomAttributes = "";
			$ReportTransaction->remarks->HrefValue = "";
			$ReportTransaction->remarks->TooltipValue = "";

			// consignment_no
			$ReportTransaction->consignment_no->LinkCustomAttributes = "";
			$ReportTransaction->consignment_no->HrefValue = "";
			$ReportTransaction->consignment_no->TooltipValue = "";

			// quantity
			$ReportTransaction->quantity->LinkCustomAttributes = "";
			$ReportTransaction->quantity->HrefValue = "";
			$ReportTransaction->quantity->TooltipValue = "";

			// price
			$ReportTransaction->price->LinkCustomAttributes = "";
			$ReportTransaction->price->HrefValue = "";
			$ReportTransaction->price->TooltipValue = "";

			// totalprice
			$ReportTransaction->totalprice->LinkCustomAttributes = "";
			$ReportTransaction->totalprice->HrefValue = "";
			$ReportTransaction->totalprice->TooltipValue = "";

			// weight
			$ReportTransaction->weight->LinkCustomAttributes = "";
			$ReportTransaction->weight->HrefValue = "";
			$ReportTransaction->weight->TooltipValue = "";

			// totalweight
			$ReportTransaction->totalweight->LinkCustomAttributes = "";
			$ReportTransaction->totalweight->HrefValue = "";
			$ReportTransaction->totalweight->TooltipValue = "";

			// item_name
			$ReportTransaction->item_name->LinkCustomAttributes = "";
			$ReportTransaction->item_name->HrefValue = "";
			$ReportTransaction->item_name->TooltipValue = "";
		}

		// Call Row Rendered event
		if ($ReportTransaction->RowType <> EW_ROWTYPE_AGGREGATEINIT)
			$ReportTransaction->Row_Rendered();
	}

	// Set up export options
	function SetupExportOptions() {
		global $Language, $ReportTransaction;

		// Printer friendly
		$item =& $this->ExportOptions->Add("print");
		$item->Body = "<a href=\"" . $this->ExportPrintUrl . "\">" . "<img src=\"phpimages/print.gif\" alt=\"" . ew_HtmlEncode($Language->Phrase("PrinterFriendly")) . "\" title=\"" . ew_HtmlEncode($Language->Phrase("PrinterFriendly")) . "\" width=\"16\" height=\"16\" border=\"0\">" . "</a>";
		$item->Visible = TRUE;

		// Export to Excel
		$item =& $this->ExportOptions->Add("excel");
		$item->Body = "<a href=\"" . $this->ExportExcelUrl . "\">" . "<img src=\"phpimages/exportxls.gif\" alt=\"" . ew_HtmlEncode($Language->Phrase("ExportToExcel")) . "\" title=\"" . ew_HtmlEncode($Language->Phrase("ExportToExcel")) . "\" width=\"16\" height=\"16\" border=\"0\">" . "</a>";
		$item->Visible = TRUE;

		// Export to Word
		$item =& $this->ExportOptions->Add("word");
		$item->Body = "<a href=\"" . $this->ExportWordUrl . "\">" . "<img src=\"phpimages/exportdoc.gif\" alt=\"" . ew_HtmlEncode($Language->Phrase("ExportToWord")) . "\" title=\"" . ew_HtmlEncode($Language->Phrase("ExportToWord")) . "\" width=\"16\" height=\"16\" border=\"0\">" . "</a>";
		$item->Visible = TRUE;

		// Hide options for export/action
		if ($ReportTransaction->Export <> "")
			$this->ExportOptions->HideAllOptions();
	}

	// Page Load event
	function Page_Load() {

		//echo "Page Load";
	}

	// Page Unload event
	function Page_Unload() {

		//echo "Page Unload";
	}

	// Page Redirecting event
	function Page_Redirecting(&$url) {

		// Example:
		//$url = "your URL";

	}

	// Message Showing event
	// $type = ''|'success'|'failure'
	function Message_Showing(&$msg, $type) {

		// Example:
		//if ($type == 'success') $msg = "your success message";

	}

	// Page Data Rendering event
	function Page_DataRendering(&$header) {

		// Example:
		//$header = "your header";

	}

	// Page Data Rendered event
	function Page_DataRendered(&$footer) {

		// Example:
		//$footer = "your footer";

	}
}
?>
